<%-- 
    Document   : top-navigation
    Created on : 08-Dec-2012, 14:53:16
    Author     : Roald
--%>
<%@page import="nl.hva.web.mvcwebapp.models.User"%>
<%@page import="nl.hva.web.mvcwebapp.doa.UserDAO"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@page import="nl.hva.web.mvcwebapp.controllers.UserController"%>
<%-- get user type, only once --%>
<%
    HttpSession session_user = request.getSession(true);
    String firstname = (String) session_user.getAttribute("user_firstname");
    String language = (String) session_user.getAttribute("lang");
    int user_id = 0;
    int user_type = 0;
    if (firstname != null) {
        user_id = Integer.parseInt("" + session_user.getAttribute("user_id"));
        user_type = Integer.parseInt("" + session_user.getAttribute("user_type"));
    }

%>

<!--  **************** Multi Language ******************** -->
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%
    session = request.getSession(true);
    String lang = (String) session.getAttribute("lang");
    if (lang == null) {
        //default language if language not set.
        lang = "en";
    }
%>
<fmt:setLocale value="<%=lang%>" />
<fmt:setBundle basename="<%=lang%>" />
<!--  **************** Multi Language END ******************** -->

<c:if test="${empty requestScope.usertype}"><% request.setAttribute("usertype", UserController.userAccountType);%></c:if>
<%-- Header Component: /WEB-INF/widgets/top-navigation.jsp --%>
<div class="header-wrapper"> <!-- Start Header-Wrapper -->
    <div class="header left">
        <div class="logo left">
            <a href="<%=request.getContextPath()%>" alt="Three2Learn Digital Learning Experience">Three2Learn Digital Learning Experience</a>
        </div>

    </div>
    <div class="language right">
        <ul>
            <li <c:if test="${lang eq 'en'}">class="active"</c:if> id="english"><a href="<%=request.getContextPath()%>/pages/language?lang=en">English</a></li>
            <li <c:if test="${lang eq 'nl'}">class="active"</c:if> id="dutch"><a href="<%=request.getContextPath()%>/pages/language?lang=nl">Dutch</a></li> 
        </ul>
    </div>

    <ul class="navigation right">

        <!--        <li>
                    <a href="<%=request.getContextPath()%>">Home</a>
                </li>-->
        <li>
            <a href="<%=request.getContextPath()%>/course/catalog"><font size="5"><fmt:message key="course" /></font></a>
        </li>
        <% if (firstname != null) {
        %>
        <li>
            <a href="<%=request.getContextPath()%>/forum"><font size="5">Forum</font></a>
        </li>
        <%}%>
        <li>
            <a href="<%=request.getContextPath()%>/news"><font size="5"><fmt:message key="news" /></font></a>
        </li>
        <%if (user_type == 3) {
        %>
        <li>
            <a href="<%=request.getContextPath()%>/users"><font size="5"><fmt:message key="users" /></font></a>
        </li> 

        <li>
            <a href="<%=request.getContextPath()%>/pages"><font size="5"><fmt:message key="pages" /></font></a>
        </li> 
        
        <li>
            <a href="<%=request.getContextPath()%>/admin/"><font size="5">Admin</font></a>
        </li> 

        <%
            }%>

        <%-- if a user is logged in, present userprofile --%>

        <% if (firstname == null) {
        %>
        <li>
            <a href="<%=request.getContextPath()%>/login"><font size="5"><fmt:message key="login"/></font></a>
        </li>

        <li>
            <a href="<%=request.getContextPath()%>/register"><font size="5"><fmt:message key="signUp"/></font></a>
        </li>
        <% }%>
    </ul>
    <br class="clearfix">
</div><!-- End Header Wrapper -->
